<table id="ssh_enable_table" class="overview">
    <tr class="overviewHead" style="width: 50%;">
        <td class="padding10 first-collumn" style="width: 15%;" class="help_cursor">
					<span title="It's just name alias. This alias will be use in 'Servers' page for choose credentials">{{lang.words.name|title()}}<span>
        </td>
        <td class="first-collumn" style="width: 25%;" class="help_cursor" id="ssh-key-enabled-td">
            <span title="If it is enabled, the key will be used, if turned off - the password. Do not forget to download the keys to all servers or install the sudo without a password">SSH {{lang.words.key}}</span>
        </td>
        {% if g.user_params['role'] == 1 %}
        <td style="width: 25%;">{{lang.words.group|title()}}</td>
        {% endif %}
        <td style="width: 100%;" class="help_cursor" id="ssh-user-name-td">
            <span title="Enter SSH user name. If SSH key disabled, enter password for SSH user">{{lang.words.username|title()}}</span>
        </td>
        <td></td>
    </tr>
    {% for ssh in sshs %}
    <tr style="width: 50%;" id="ssh-table-{{ssh.id}}" class="{{ loop.cycle('odd', 'even') }}">
        <td class="first-collumn padding10">
            {% set id = 'ssh_name-' + ssh.id|string() %}
            {{ input(id, value=ssh.name, size='15') }}
        </td>
        <td class="first-collumn" valign="top" style="padding-top: 15px;">
            {% if ssh.enable == 1 %}
            <label for="ssh_enable-{{ssh.id}}">{{lang.words.enable|title()}} SSH {{lang.words.key}}</label><input type="checkbox" id="ssh_enable-{{ssh.id}}" checked>
            {% else %}
            <label for="ssh_enable-{{ssh.id}}">{{lang.words.enable|title()}} SSH {{lang.words.key}}</label><input type="checkbox" id="ssh_enable-{{ssh.id}}">
            {% endif %}
        </td>
        {% if g.user_params['role'] == 1 %}
        <td>
            <select id="sshgroup-{{ssh.id}}" name="sshgroup-{{ssh.id}}">
                {% for group in groups %}
                {% if ssh.groups == group.group_id %}
                <option value="{{ group.group_id }}" selected>{{ group.name }}</option>
                {% else %}
                <option value="{{ group.group_id }}">{{ group.name }}</option>
                {% endif %}
                {% endfor %}
            </select>
        </td>
        {% endif %}
        <td style="padding-top: 15px;">
            <p>
                {% set id = 'ssh_user-' + ssh.id|string() %}
                {{ input(id, value=ssh.username, title='SSH user name') }}
            </p>
            {% if ssh.enable == 1 %}
            <input type="password" id="ssh_pass-{{ssh.id}}" class="form-control" title="User password, if SSH key is disabled" placeholder="*****" style="display: none;" autocomplete="new-password">
            {% else %}
            <input type="password" id="ssh_pass-{{ssh.id}}" class="form-control" title="User password, if SSH key is disabled" placeholder="*****" autocomplete="new-password">
            {% endif %}
            <br>
        </td>
        <td>
            <a class="delete" onclick="confirmDeleteSsh({{ssh.id}})" title="{{lang.words.delete|title()}} SSH {{lang.words.creds}} {{ssh.name}}" style="cursor: pointer;"></a>
        </td>
    </tr>
    {% endfor %}
</table>
<br /><span class="add-button" title="{{lang.words.add|title()}} SSH" id="add-ssh-button">+ {{lang.words.add|title()}}</span>
<br /><br />
<table id="ssh_key">
    <tr class="overviewHead">
        <td class="padding10 first-collumn">{{lang.words.upload|title()}} SSH {{lang.words.key}}</td>
        <td style="width: 25%;">{{lang.phrases.ssh_passphrase}}</td>
        <td class="help_cursor">
            <span title="{{lang.phrases.private_key_note}}">{{lang.words.key|title()}}</span>
        </td>
        <td></td>
    </tr>
    <tr>
        <td class="first-collumn padding10" style="padding-top: 15px;">
            <select id="ssh-key-name">
                <option disabled selected>------</option>
                {% for ssh in sshs %}
                <option value={{ssh.name}}>{{ssh.name}}</option>
                {% endfor %}
            </select>
        </td>
        <td>{{ input('ssh-key-pass', title=lang.phrases.ssh_passphrase, type='password') }}</td>
        <td style="padding-top: 15px;">
            <textarea id="ssh_cert" cols="50" rows="5"></textarea><br /><br />
            <a class="ui-button ui-widget ui-corner-all" id="ssh_key_upload" title="{{lang.words.upload|title()}} SSH {{lang.words.key}}" onclick="uploadSsh()">{{lang.words.upload|title()}}</a>
        </td>
        <td></td>
    </tr>
</table>
<div id="ajax-ssh"></div>
<div class="add-note alert addName alert-info" style="width: inherit; margin-right: 15px;">
    {{lang.phrases.read_about_parameters}} <a href="https://roxy-wi.org/description/creds" title="Servers description" target="_blank">{{lang.words.here}}</a>.
    {{lang.phrases.read_howto}} <a href="https://roxy-wi.org/howto/setup" title="How to setup servers, group and SSH credentials" target="_blank">{{lang.words.article}}</a>
</div>
